package main

import (
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/theme"
	themex "github.com/zhaocy/fyne-theme"
)

func main() {
	myApp := app.New()
	myApp.Settings().SetTheme(themex.Themex())
	myWin := myApp.NewWindow("image")

	image := canvas.NewImageFromResource(theme.FyneLogo())
	image.Resize(fyne.NewSize(100, 100))

	//渐变
	gradient := canvas.NewHorizontalGradient(color.RGBA{0, 0, 255, 255}, color.Transparent)
	gradient.Resize(fyne.NewSize(300, 50))
	gradient.Move(fyne.NewPos(0, 100))

	gradient2 := canvas.NewHorizontalGradient(color.RGBA{0, 0, 255, 255}, color.RGBA{255, 0, 0, 255})
	gradient2.Resize(fyne.NewSize(300, 50))
	gradient2.Move(fyne.NewPos(0, 150))

	myWin.SetContent(container.NewVBox(
		container.NewWithoutLayout(image),
		container.NewWithoutLayout(gradient),
		container.NewWithoutLayout(gradient2),
	))
	myWin.Resize(fyne.NewSize(550, 450))
	myWin.ShowAndRun()
}
